<%if(results.length && _.first(results).get("doc")!=null){%>
<div class="found">Found <%= results.length%> doctors matching your search.</div>
<% _.each(results, function(result){ %>
	<div class="searchresultcontainer">
	
			<div class="doctorimage">
				<%if(result.get("doc").doctorDetails.doctor.provider=="google")%>
				<img class="s-img" src="https://profiles.google.com/s2/photos/profile/<%= result.get('doc').doctorDetails.doctor.userid%>"
					onError="this.onerror=null;this.src='/assets/images/no_person.png';" >
				<%if(result.get("doc").doctorDetails.doctor.provider=="facebook")%>
				<img class="s-img" src="https://graph.facebook.com/<%= result.get('doc').doctorDetails.doctor.userid%>/picture"
				onError="this.onerror=null;this.src='/assets/images/no_person.png';">
				<%if(result.get("doc").doctorDetails.doctor.provider=="twitter")%>
				<img class="s-img" src="https://api.twitter.com/1/users/profile_image?user_id=<%= result.get('doc').doctorDetails.doctor.userid%>"
				onError="this.onerror=null;this.src='/assets/images/no_person.png';">
				<%if(result.get("doc").doctorDetails.doctor.provider=="linkedin"){%>
				<img class="s-img" src="/assets/images/no_person.png">
				<%}%>
			</div>
	
			<div>
				<table class="searchtable">
					<tr>
						<td><label >Name: <strong>Dr. <%=result.get("doc").doctorDetails.doctor.name%></strong> </label>
						</td>
						<td><div data="<%=result.get('doc').doctorDetails.doctor.id%>" hospital ="<%=result.get('doc').hospitals.id%>" class="takeappointment" >Take Appointment</div>
						</td>
					</tr>
					<tr>
						<td><label >Speciality: <strong><%=result.get("doc").doctorDetails.specialities.speciality%></strong> </label>
						</td>
						<td>
							<div class="schedule">
								<% var schedules = result.get("sch")%>
								<% var days = ["","Su","M","Tu","W","Th","F","Sa"]%>
								<%var lastday%>
								<% for(var i in schedules){ %>
									<%if(lastday != schedules[i].day){%>
										<div class="eachschedule">
											<%= days[schedules[i].day]%>
											<%lastday=schedules[i].day%>
										</div>
									<%}%>
								<%}%>
							</div>			
						</td>
					</tr>
					<tr>
						<td><label >Hospital: <strong><%=result.get("doc").hospitals.hospitalName%></strong> </label>
					</tr>
					
				</table>
				
					
			</div>
			
	</div>
	<% }); %>
	<%} else{%>
		<div class="found">No doctors matched your criteria.</div>
	<%}%>
